<?php



namespace app\index\controller;



use think\Controller;
use think\Db;



/**

 * 信用卡 手机端 控制器

 *

 * 2018-11-3

 *

 * @author 小雨

 *        

 */

class CreditCard extends Controller {

	public function index() {
		//排行榜数据
	    $sql = "SELECT `logo`,`bankname`,`vir_number`,`id`,`tishi` FROM ims_xuan_zy_bank where status = 1  order by  rank desc limit 0,5";
        $articles = DB::query($sql);
        $this->assign("articles",$articles);
        //银行卡数据
        $sql = "SELECT * FROM  ims_xuan_zy_bank where status=1 and uniacid=2  order by rank desc";
        $bank = DB::query($sql);
        $this->assign("bank",$bank);
        // 轮播数据
        $huan=DB::query("SELECT * FROM ims_xuan_zy_bank where status=1 and tuijian=1 and uniacid=2 order by rank desc");
        $a = 0;
     	foreach ($huan as $key => $value) {
            if($key%3==0){
     	      	$a++;
            }
            $data[$a][] = $value;
     	};
        $this->assign("huan",$data);
        //头部信息
        $top=DB::query("SELECT logo FROM ims_xuan_zy_huan where status=1 and type='首页头部2' and uniacid=2 order by rank desc")[0]['logo'];
        $this->assign("top",$top);
		return $this->fetch();

	}

}



?>